package com.biscuit.page.basicservice.remote.api;

import com.biscuit.common.base.BaseModelResponse;
import com.biscuit.common.base.BaseResponse;
import com.biscuit.common.base.BaseResponseVoid;
import com.biscuit.page.basicservice.api.IUserRemote;
import com.biscuit.page.basicservice.api.model.request.user.*;
import com.biscuit.page.basicservice.api.model.response.user.UserInfoAResp;
import com.biscuit.page.basicservice.service.UserService;
import com.biscuit.page.basicservice.utils.BaseResponseUtil;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author biscuit
 * @createTime 2024/6/25 10:26
 */
@RestController
public class UserRemoteImpl implements IUserRemote {

    @Resource
    private UserService service;

    @Override
    public BaseResponse<UserInfoAResp> getUserInfo(UserIdAReq req) {
        return BaseResponseUtil.success(this.service.getUserInfo(req));
    }

    @Override
    public BaseResponse<BaseResponseVoid> resetPasswordDefault(UserIdAReq req) {
        this.service.execResetPasswordDefault(req);
        return BaseResponseUtil.success();
    }

    @Override
    public BaseResponse<BaseResponseVoid> resetPassword(UserResetPasswordAReq req) {
        this.service.execResetPassword(req);
        return BaseResponseUtil.success();
    }

    @Override
    public BaseResponse<BaseResponseVoid> updateAvatarAndNickName(UserUpdateAvatarAndNickNameAReq req) {
        this.service.updateAvatarAndNickName(req);
        return BaseResponseUtil.success();
    }

    @Override
    public BaseResponse<BaseResponseVoid> updateEmail(UserUpdateEmailAReq req) {
        this.service.updateEmail(req);
        return BaseResponseUtil.success();
    }

    @Override
    public BaseResponse<BaseResponseVoid> updateMobile(UserUpdateMobileAReq req) {
        this.service.updateMobile(req);
        return BaseResponseUtil.success();
    }

    @Override
    public BaseResponse<BaseModelResponse<String>> updateEmailOrMobileVerifyCodeCheck(UserUpdateEmailOrMobileVerifyCodeCheckAReq req) {
        return BaseResponseUtil.success(this.service.updateEmailOrMobileVerifyCodeCheck(req));
    }
}
